import request from "@/request/request";
import requestMock from "@/request/requestMock";
// 1- 获取首页的三级列表的数据
export const reqGetCategort = () => {
	return request.get('product/getBaseCategoryList')
}

// 2- 获取首页的轮播图数据
export const reqGetBannerList = () => {
	return requestMock.get('/home/banner')
}

// 3- 获取首页的floor数据
export const reqGetFloorList = () => {
	return requestMock.get('/home/floor')
}

// 4- 获取搜索页的数据
export const reqGetSearchList = (searchUrl) => {
	return request.post('/list', searchUrl)
}
// 5- 获取商品详情的数据
export const reqGetDetailsList = (skuId) => {
	return request.get(`/item/${skuId}`)
}
// 6- 添加到购物车(对已有物品进行数量改动)
export const reqPostAddToCart = (skuId, skuNum) => {
	return request.post(`/cart/addToCart/${skuId}/${skuNum}`)
}
// 7- 获取购物车列表
export const reqGetCartList = () => {
	return request.get(`/cart/cartList`)
}
// 8- 删除单个购物车列表的数据
export const reqDeleteCart = (skuId) => {
	return request.delete(`/cart/deleteCart/${skuId}`)
}
// 9- 修改单个选中状态
export const reqGetCheckedCart = (skuId, isChecked) => {
	return request.get(`/cart/checkCart/${skuId}/${isChecked}`)
}
// 10- 批量选中商品
export const reqPostBatchCheckCart = (isChecked, skuIdList) => {
	return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
}
// 11- 批量删除购物车
export const reqPostBatchDeleteCart = (skuIdList) => {
	return request.delete(`/cart/batchDeleteCart`, {
		data: skuIdList
	})
}
// 12- 获取注册验证码
export const reqGetSendCode = (phone) => {
	return request.get(`/user/passport/sendCode/${phone}`)
}
// 13- 注册用户
export const reqPostRegister = (userInfo) => {
	return request.post(`/user/passport/register`, userInfo)
}
// 14- 登录
export const reqPostLogin = (userInfo) => {
	return request.post(`/user/passport/login`, userInfo)
}
//15. 请求用户信息（需要携带token）
export const reqGetUserInfo = () => {
	return request.get(`/user/passport/auth/getUserInfo`)
}
//16 退出登录并是token过期
export const reqGetLogout = () => {
	return request.get(`/user/passport/logout`)
}
// 17- 获取订单交易页的快递地址
export const reqGetAddressList = () => {
	return requestMock.get(`/user/userAddress/auth/findUserAddressList`)
}
// 18- 获取订单交易页的商品信息
export const reqGetTradeInfo = () => {
	return request.get(`/order/auth/trade`)
}
// 19- 根据订单交易编号获取订单号
export const reqPostSubmitOrder = (tradeNo, tradeInfo) => {
	return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, tradeInfo)
}
// 20- 根据订单编号 获取 订单要支付的信息
export const reqGetCreateNative = (orderId) => {
	return request.get(`/payment/weixin/createNative/${orderId}`)
}
// 21- 根据订单编号 查看当前订单是否支付成功
export const reqGetPayStatus = (orderId) => {
	return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}
//22.获取订单的分页列表
export const reqGetOrderList = ({page, limit}) => {
	return request.get(`/order/auth/${page}/${limit}`)
}
